<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>switch</title>
</head>
<body>
    <script>
        function test(age){
            let msg = "";
            switch(true){
                case age > 60:
                    msg = "老年";
                    break;
                case age > 20:
                case age > 30:
                case age > 40:
                case age > 50:
                    msg = "非老年";
                    break;
                default:
                    msg = "传错了";
            }
            return msg;
        }

       console.log(test(30)) ;
        
    </script>
</body>
</html>